package org.dromara.system.domain;

import lombok.Data;
import org.springframework.beans.factory.annotation.Value;

@Data
public class AccessToken {

    private String accessToken;

    private Long expiresTime;

    public AccessToken(String accessToken, String expiresIn) {
        this.accessToken = accessToken;
        this.expiresTime = System.currentTimeMillis()+Integer.parseInt(expiresIn)*1000;
    }

    public AccessToken(String accessToken, Long expiresTime) {
        this.accessToken = accessToken;
        this.expiresTime = expiresTime;

    }
        /**
         * 判断token是否过期
         * @return
         */
        public boolean isExpired () {
            return System.currentTimeMillis() > expiresTime;
        }

}
